package com.olt.dao.oltTest;


import com.olt.domain.oltTest.OltProblemGroup;
import com.olt.server.dto.SelectDto;
import org.springframework.data.domain.Page;

import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.UUID;


public interface IOltProblemGroup extends JpaRepository<OltProblemGroup, String> {

    Page<OltProblemGroup> findAllByCreateUserOrderByDateDesc(Long user, Pageable page);

    @Modifying
    void deleteAllByProblemGroupIdIn(List<String> uuids);

    @Query(value = "select new com.olt.server.dto.SelectDto(pg.problemGroupId,'',pg.groupName) from OltProblemGroup pg " +
            "where pg.createUser=?1")
    List<SelectDto<UUID>> findALlBYSelect(Long userId);
}
